<!--
 * @Description  : 
 * @Version      : 1.0
 * @Author       : Shiming
 * @Date         : 2022-01-12 10:52:50
 * @LastEditors  : Shiming
 * @LastEditTime : 2022-04-19 16:21:02
 * @FilePath     : \\tms-obc-web\\src\\app\\routes\\order-management\\components\\risk\\risk.component.html
 * Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<!-- 搜索表单 -->
<!-- <page-header-wrapper [title]="''"> </page-header-wrapper>
<nz-card>
  <div nz-row nzGutter="8">
    <div nz-col [nzSpan]="_$expand ? 24 : 18">
      <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
    </div>
    <div nz-col [nzSpan]="_$expand ? 24 : 6" class="text-right">
      <button nz-button nzType="primary" [nzLoading]="service.http.loading" (click)="search()" acl
        [acl-ability]="['ORDER-RISK-search']">查询</button>
      <button nz-button nzType="primary" [disabled]="false" (click)="exprot()">导出</button>
      <button nz-button [disabled]="false" (click)="resetSF()">重置</button>
      <button nz-button nzType="link" (click)="expandToggle()">
        {{ !_$expand ? '展开' : '收起' }}
        <i nz-icon [nzType]="!_$expand ? 'down' : 'up'"></i>
      </button>
    </div>
  </div>
</nz-card> -->

<nz-card class="table-box">
  <div class="tab_header">
    <label class="page_title"> <label class="driver">|</label> 风险单管理</label>
    <nz-tabset (nzSelectedIndexChange)="selectChange($event)" [nzTabBarExtraContent]="extraTemplate">
      <nz-tab [nzTitle]="'全部'"></nz-tab>
      <nz-tab [nzTitle]="'待申诉(' + tabs?.stayQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'申诉中(' + tabs?.underwayQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'申诉成功(' + tabs?.receivedQuantity + ')'"></nz-tab>
      <nz-tab [nzTitle]="'申诉失败(' + tabs?.cancelQuantity + ')'"></nz-tab>
    </nz-tabset>
  </div>

  <div>
    <st #st [bordered]="true" [scroll]="{ x: '2000px',y:scrollY  }" [data]="service.$api_get_listRiskPage" [columns]="columns"
      [req]="{  process: beforeReq }"
      [res]="{ reName: { list: 'data.records', total: 'data.total' } , process: afterRes}"
      [page]="{ show: true, showSize: true, pageSizes: [10, 20, 30, 50, 100, 200, 300, 500, 1000] }" [loading]="false">
      <!-- <ng-template st-row="billCode" let-item let-index="index">
        <a  [routerLink]="'/order-management/risk-detail/' + item.id">{{ item.billCode }}</a>
        <div>
          <span>{{ item?.representationsStatusLabel }}</span>
        </div>
        <div>
          <span >{{item?.billTypeLabel}}{{item?.billTypeLabel === item?.serviceTypeLabel ? '' : item?.serviceTypeLabel}}</span>
        </div>
      </ng-template> -->
      <ng-template st-row="billCode" let-item let-index="index">
        <!-- <div>{{ item.billCode }}</div> -->
        <a *ngIf="item.billType == '1'" [routerLink]="'/order-management/vehicle/vehicle-detail/' + item.id">{{
          item.billCode }}</a>
        <a *ngIf="item.billType == '2'" [routerLink]="'/order-management/bulk/bulk-detail/' + item.id">{{ item.billCode
          }}</a>
        <a *ngIf="item.billType == '3'" [routerLink]="'/order-management/vehicle/vehicle-detail/' + item.id">{{
          item.billCode }}</a>
        <div>
          <span>{{item?.billSourceLabel}}{{ item?.billSource == 1 ? 
            item?.serviceTypeLabel : '' }}</span>
        </div>
      </ng-template>
      <ng-template st-row="timeer" let-item let-index="index">
        <p>创建时间：{{ item?.createTime }}</p>
        <p>装货时间：{{ item?.loadTime }}</p>
        <p>卸货时间：{{ item?.unloadTime }}</p>
      </ng-template>
      <ng-template st-row="billComplianceVOS" let-item let-index="index">
        <div *ngFor="let items of item?.billComplianceVOS">
          <div>{{items.complianceName}}</div>
        </div>
      </ng-template>
      <ng-template st-row="driverName" let-item let-index="index">
        <div> {{ item?.driverName }}{{ item?.driverPhone ? "/" + item?.driverPhone : '' }}{{ item?.carNo ? "/" +
          item?.carNo : ''}} </div>
      </ng-template>
      <ng-template st-row="payeeName" let-item>
        <div *ngIf="item?.driverId !== item?.payeeId">
          <div>{{item.payeeName}}</div>
          <div>{{item.payeePhone}}</div>
        </div>
        <div *ngIf="item?.driverId === item?.payeeId">-</div>
      </ng-template>
      <ng-template st-row="freightDetails" let-item let-index="index">
        <div *ngIf="item.freightDetails.length > 0">
          <p *ngFor="let data of item.freightDetails"> {{ data.expenseName }}：{{ data.price | currency }} </p>
        </div>
      </ng-template>
      <ng-template st-row="goodsInfoVOList" let-item let-index="index">
        <div *ngFor="let i of item?.goodsInfoVOList">
          <p>货物名称：{{ i?.goodsName }}</p>
          <p>重量/体积：{{ i?.weight ? i?.weight + '吨' : '' }}{{ i?.volume ? "/" + i?.volume + '方' : ''}}</p>
          <p>车型/车长：{{ i?.carModelLabel }} {{ i?.carLengthLabel ? "/" + i?.carLengthLabel : ''}}</p>
        </div>
      </ng-template>
    </st>
  </div>
</nz-card>

<nz-modal [(nzVisible)]="isVisibleRE" [nzWidth]="600" [nzFooter]="nzModalFooterview2" (nzOnOk)="handleOK()" nzTitle="审核"
  (nzOnCancel)="handleCancel()">
  <ng-container *nzModalContent>
    <sf #sfView [schema]="schemaView" [ui]="uiView" [compact]="true" [button]="'none'"> </sf>
  </ng-container>
  <ng-template #nzModalFooterview2>
    <button nz-button nzType="default" (click)="reject()">拒绝</button>
    <button nz-button nzType="primary" (click)="handleOK()">通过</button>
  </ng-template>
</nz-modal>

<ng-template #extraTemplate>
  <div class="mr-sm">
    <button nz-button nzDanger [nzLoading]="service.http.loading" (click)="openDrawer()" acl
      [acl-ability]="['ORDER-RISK-search']">筛选</button>
    <button nz-button nzDanger [disabled]="false" (click)="exprot()">导出</button>
    <button nz-button nzType="primary" (click)="audit()" acl [acl-ability]="['ORDER-RISK-batchAudit']"> 批量审核 </button>

  </div>
</ng-template>